/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author uriel
 */
@Entity
@Table(name = "SINIESTRO_MATERIAL")
@NamedQueries({
    @NamedQuery(name = "SiniestroMaterial.findAll", query = "SELECT s FROM SiniestroMaterial s")})
public class SiniestroMaterial implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "SINIESTRO_ID")
    private Long siniestroId;
    @Basic(optional = false)
    @Column(name = "DESCRIPCION")
    private String descripcion;
    @Basic(optional = false)
    @Column(name = "BANDERA_GRUA")
    private short banderaGrua;
    @Lob
    @Column(name = "IMAGEN")
    private Serializable imagen;
    @JoinColumn(name = "SINIESTRO_ID", referencedColumnName = "SINIESTRO_ID", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Siniestro siniestro;

    public SiniestroMaterial() {
    }

    public SiniestroMaterial(Long siniestroId) {
        this.siniestroId = siniestroId;
    }

    public SiniestroMaterial(Long siniestroId, String descripcion, short banderaGrua) {
        this.siniestroId = siniestroId;
        this.descripcion = descripcion;
        this.banderaGrua = banderaGrua;
    }

    public Long getSiniestroId() {
        return siniestroId;
    }

    public void setSiniestroId(Long siniestroId) {
        this.siniestroId = siniestroId;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public short getBanderaGrua() {
        return banderaGrua;
    }

    public void setBanderaGrua(short banderaGrua) {
        this.banderaGrua = banderaGrua;
    }

    public Serializable getImagen() {
        return imagen;
    }

    public void setImagen(Serializable imagen) {
        this.imagen = imagen;
    }

    public Siniestro getSiniestro() {
        return siniestro;
    }

    public void setSiniestro(Siniestro siniestro) {
        this.siniestro = siniestro;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (siniestroId != null ? siniestroId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SiniestroMaterial)) {
            return false;
        }
        SiniestroMaterial other = (SiniestroMaterial) object;
        if ((this.siniestroId == null && other.siniestroId != null) || (this.siniestroId != null && !this.siniestroId.equals(other.siniestroId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.SiniestroMaterial[ siniestroId=" + siniestroId + " ]";
    }
    
}
